using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerIdleState : PlayerGroundState
{
    public PlayerIdleState(Player player, PlayerMoveData playerData, StateMachine stateMachine, string animBoolName) : base(player, playerData, stateMachine, animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        player.SetVelocityX(0);
    }

    public override void LogicUpdate()
    {
        base.LogicUpdate();

        player.transform.position = enterPos;

        if (stateMachine.CurrentState != this) { return; }

        if (yInput == -1 || isTouchingCeiling)
        {
            stateMachine.ChangeState(player.CrouchIdleState);
        }
        else if(xInput != 0) 
        {
            stateMachine.ChangeState(player.MoveState);
        }
    }
}
